/**
 * Created by MenglongLi on 2019/8/29.
 * 修改下列函数可实现类名的个性化配置
 */


//列名转字段名
var columnNameToFieldName = function (columnName) {
    return toHumpName(columnName);
}

//表名转实体类名
var tableNameToBeanClassName = function (tableName) {
    var beanName=toHumpName(tableName);
    return beanName.charAt(0).toUpperCase()+beanName.substring(1);
}
//实体类名转Dao类名
var beanClassNameToDaoClassName = function (beanClassName) {
    return beanClassName + "Mapper";
}

//实体类名转Service类名
var beanClassNameToServiceClassName = function (beanClassName) {
    return beanClassName + "Service";
}
//实体类名转Controller类名
var beanClassNameToControllerClassName = function (beanClassName) {
    return beanClassName + "Controller";
}


//转驼峰命名（如：aa_bb_cc -> aaBbCc）
function toHumpName(str) {
    if (str === null)
        return null;
    var beanName = "";
    var names = str.split("_");
    for (var i = 0; i < names.length; i++) {
        var subStr = names[i];
        if (subStr.length() > 1) {
            beanName += (subStr.charAt(0) + "").toUpperCase() + subStr.substring(1).toLowerCase();
        } else {
            beanName += subStr.toUpperCase();
        }
    }
    return (beanName.charAt(0) + "").toLowerCase() + beanName.substring(1);
}
